// hyb_yl/teamjj/teamjj.js
var app = getApp();
var bmap = require('../../../../utils/bmap-wx.min.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabs: ["简介", "成员"],
    current: 0
  },
  //tab切换
  tabs(e) {
    var t_id = e.currentTarget.dataset.t_id
    if (e.currentTarget.dataset.dex == 0) {
      this.getTeamjianjie(t_id)
    }else{
      this.getTeamdoc(t_id)
    }
    this.setData({
      current: e.currentTarget.dataset.dex
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    var t_id = options.t_id
    this.setData({
      t_id: t_id
    })
    this.getTeamjianjie(t_id)
  },
  //团队简介与团队成员
  getTeamjianjie: function(t_id) {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/Teamxiangguan',
      'data': {
        t_id: t_id,
        op: 'get'
      },
      success: function(res) {
        console.log(res)
        that.setData({
          teamtext: res.data.teamtext
        })
      }
    })
  },
  getTeamdoc: function (t_id){
    var that = this
    app.util.request({
      'url': 'entry/wxapp/Teamxiangguan',
      'data': {
        t_id: t_id,
        op: 'post'
      },
      success: function (res) {
        console.log(res)
        that.setData({
          zhuanjia: res.data
        })
      }
    })
  },
  saveFormId: function(e) {
    var form_id = e.detail.formId
    var openid = wx.getStorageSync('openid')
    var id = e.detail.value.id
    var u_id = e.detail.value.u_id
    app.util.request({
      'url': 'entry/wxapp/UserFormId',
      'data': {
        form_id: form_id,
        openid: openid
      },
      success: function(res) {
        console.log(res)
        wx.navigateTo({
          url: '/hyb_yl/zhuanjiasubpages/pages/zhuanjiazhuye/zhuanjiazhuye?id=' + id + '&u_id=' + u_id,
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})